import VueRouter from "vue-router";
import Login from "@/components/Login.vue";
const routes=[
    {
    path:'/',
    name:"Login",
    component:()=>import('../components/Login.vue')
},
    {
        path:'/',
        name:'Index',
        component:()=>import('../components/Index.vue'),
        children:[
            {
                path:'/Home',
                name:'home',
                meta:{
                    title:"首页"
                },
                component:()=>import('../components/Home.vue')
            },
            {
                path:'/Admin',
                name:'admin',
                meta:{
                    title:"管理员管理"
                },
                component:()=>import('../components/admin/AdminManage.vue')
            },
            {
                path:'/User',
                name:'user',
                meta:{
                    title:"用户管理"
                },
                component:()=>import('../components/user/UserManage.vue')
            },
            {
                path:'/Team',
                name:'team',
                meta:{
                    title:"球队管理"
                },
                component:()=>import('../components/team/TeamManage.vue')
            },
            {
                path:'/Groups',
                name:'groups',
                meta:{
                    title:"小组赛管理"
                },
                component:()=>import('../components/groups/GroupsManage.vue')
            },
            {
                path:'/Player',
                name:'player',
                meta:{
                    title:"球员管理"
                },
                component:()=>import('../components/player/PlayerManage.vue')
            },
        ]
    }
]
const router=new VueRouter({
    mode:'history',
    routes
})

export function resetRouter() {
    router.matcher = new VueRouter({
        mode:'history',
        routes: [],
    }).matcher
}

const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (to) {
    return VueRouterPush.call(this, to).catch(err => err)
}
export default router;